$(function(){
  init();
  function init(){
    zdetails();
  }

  //渲染
  function zdetails(){
     //发送请求
     $.get("http://193.112.55.79:9090/api/getdiscountproduct",{productid:getUrl("productid")},function(result){
       let data = result.result;
       if(data.length==0){
         $.get("http://193.112.55.79:9090/api/getmoneyctrlproduct", { productid: getUrl("productid") }, function (result) {
          let data = result.result;  
         let html = template('detailsId', { arr: data });
           $('.particulars_content_zm').html(html);
         })
       }
      let html = template('detailsId',{arr:data});
      $('.particulars_content_zm').html(html);
     })
  }

  //获得url的参数
  function getUrl(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return decodeURI(r[2]);
    return null;
  }
})